﻿// CheckModelListCtrl.cpp: 实现文件
//

#include "stdafx.h"
#include "zChecker.h"
#include "CheckModelListCtrl.h"


// CCheckModelListCtrl

IMPLEMENT_DYNAMIC(CCheckModelListCtrl, CListCtrl)

CCheckModelListCtrl::CCheckModelListCtrl()
{

}

CCheckModelListCtrl::~CCheckModelListCtrl()
{
}


BEGIN_MESSAGE_MAP(CCheckModelListCtrl, CListCtrl)
	ON_WM_CREATE()
END_MESSAGE_MAP()



// CCheckModelListCtrl 消息处理程序




int CCheckModelListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CListCtrl::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  在此添加您专用的创建代码

	return 0;
}

void CCheckModelListCtrl::Populate()
{
	DeleteAllItems();

	ck::CheckModel* pModel = NULL;
	ck::EnumCheckModel* pModels = NULL;
	ck::CheckModelManager* pModelManager = ck::CheckModelManager::GetInstance();

	pModels = pModelManager->GetModels();
	pModels->Reset();
	while ((pModel = pModels->Next()))
	{
		int nItem = InsertItem(GetItemCount(), pModel->GetName(), 0);
		SetItemData(nItem, pModel->GetCode());
	}

	pModels->Release();

}
